import { businessAxios, datashopAxios } from '@/utils/request'

/**
 * @description: 角色表=分页列表查询
 * @param {T} data
 * @return {*}
 */
export const getOrderList = (data: any): Promise<any> => {
  return businessAxios({
    url: '/api/datamarket/orders_demand/getList',
    method: 'post',
    data
  })
}

export const deleteOrderList = (data: any): Promise<any> => {
  return businessAxios({
    url: `/api/datamarket/v2/demand-orders/${data.id}`,
    method: 'delete',
    data
  })
}

export const updateOrderStatus = (data: any): Promise<any> => {
  return businessAxios({
    url: '/api/datamarket/orders_demand/putOrderStatusAndRecordOperate',
    method: 'post',
    data
  })
}
export const editOrder = (data: any): Promise<any> => {
  return businessAxios({
    url: '/api/datamarket/orders_demand/editOrder',
    method: 'post',
    data
  })
}

// 下订单
export const createDemandOrder = (data: any): Promise<any> => {
  return businessAxios({
    url: '/api/datamarket/orders_demand/create',
    method: 'post',
    data
  })
}

/**
 * 获取需求详情的基础规划订单
 * @param params
 * @returns
 */
export const basicPlanOrder = (params: any): Promise<any> => {
  return datashopAxios({
    url: `/api/datashop/v3/plan-orders/basic-plan-orders/${params.order_id}/demands/${params.demand_id}/plan_order`,
    method: 'get'
  })
}
/**
 * 获取需求详情的数仓规划订单
 * @param params
 * @returns
 */
export const industryPlanOrder = (params: any): Promise<any> => {
  return datashopAxios({
    url: `/api/datashop/v3/plan-orders/ware-plan-orders/${params.order_id}/demands/${params.demand_id}/plan_order`,
    method: 'get'
  })
}

/**
 * @returns
 * @param id
 */
export const demand_ordersId = (id: any): Promise<any> => {
  return businessAxios({
    url: `/api/datamarket/v2/demand-orders/${id}`,
    method: 'get'
  })
}

// 批量删除文件
export const batchDeleteFile = (data: any) => {
  return businessAxios({
    url: '/api/datamarket/file/deleteFileByIds',
    method: 'post',
    data
  })
}
// 获取订单流程
export const getOrderFlow = (params: any) => {
  return businessAxios({
    url: '/api/datamarket/orders_demand/getOrderWithSteps',
    method: 'get',
    params
  })
}
// 运营评估
export const updateOperateEvaluate = (data: any) => {
  return businessAxios({
    url: '/api/datamarket/orders_demand/assessment',
    method: 'post',
    data
  })
}

// 订单转派
export const transferOrder = (data: any) => {
  return businessAxios({
    url: '/api/datamarket/orders_demand/transfer',
    method: 'post',
    data
  })
}

// 计算交付数据数量
export const demandOrder_uploadPdf = (data: any) => {
  return businessAxios({
    url: '/api/datamarket/orders_demand/countExcelRows',
    method: 'post',
    data
  })
}

// 创建评价
export const evaluateDemandOrder = (data: any) => {
  return businessAxios({
    url: '/api/datamarket/v2/orders/evaluation/',
    method: 'post',
    data
  })
}

// 评价详情
export const DemandOrderEvaluateInfor = (params: any) => {
  return businessAxios({
    url: `/api/datamarket/v2/orders/evaluation/${params.id}`,
    method: 'get',
    params
  })
}

// 补充说明
export const supplementOrderNote = (data: any) => {
  return businessAxios({
    url: `/api/datamarket/v2/orders/notes/`,
    method: 'post',
    data
  })
}
// 补充说明
export const updateOrderNote = (data: any) => {
  return businessAxios({
    url: `/api/datamarket/v2/orders/notes/${data.id}`,
    method: 'put',
    data
  })
}

// 获取订单详情
export const demandOrderDetail = (params: any): Promise<any> => {
  return businessAxios({
    url: `/api/datamarket/v2/demand-orders/${params.id}`,
    method: 'get',
    params
  })
}
